home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / PACKAGE6 / REAL_STR.DOC < prev    next >
Text File  |  1990-07-25  |  2KB  |  44 lines

  1. --------------------------------------------------------------------------
  2. ChangeRealToString
  3. --------------------------------------------------------------------------
  4.  
  5. declaration:    procedure ChangeRealToString  (     RealNumber:
  6.                                                       real;
  7.                                                 var ResultString:
  8.                                                       TypeString);
  9.  
  10. purpose:        This procedure changes a real number into a string.
  11.  
  12. preconditions:  RealNumber must consist of only numerals with or without
  13.                 a decimal and with or without a + or - sign in front of it.
  14.                 ResultString._PackedArray has already been initialized from
  15.                 1 to _MaxStringLength with blanks. ResultString._Length
  16.                 is initialized with a 0.
  17.  
  18. postconditions: The correct string is returned with the characters filled
  19.                 from  1 to ResultString._Length.
  20.  
  21. special cases:  if the length of the string exceeds the maximum amount
  22.                 of characters, only the maximum characters will be returned.
  23.  
  24. example:        var
  25.                   RealNumber:
  26.                     real;
  27.                   AString:
  28.                     TypeString;
  29.  
  30.                 begin
  31.                   .
  32.                   .
  33.                   .
  34.                   readln (input, RealNumber);
  35.                   ChangeRealToString (RealNumber, ResultString);
  36.                   for Counter := 1 to AString._Length do
  37.                     write (output, AString._PackedArray[Counter]);
  38.                   .
  39.                   .
  40.                   .
  41.                 end
  42.  
  43. --------------------------------------------------------------------------
  44.